External Statement
The external statement allows you to import functions from the host language environment, such as JavaScript, which can be executed within the WebAssembly (WASM) environment. This enables Fig to interact with the host environment seamlessly.
external io {
fn log(message: char[]);
fn fetch(url: char[]): char[];
}
In this example, the io module is imported from the host environment, providing access to functions like log for logging messages and fetch for making HTTP requests.